﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Model.Custome;
using Framework;

namespace DomPrint
{
    public partial class Tape9840ShowForm : BaseShowForm
    {
        public Tape9840ShowForm(int printNum, List<ListItemInfo> listItem)
            : base(printNum, listItem)
        {
            InitializeComponent();
        }

        private void Tape9840ShowForm_Load(object sender, EventArgs e)
        {
            try
            {
                PrintPrepare();
                for (int i = 0; i < listItem.Count; i++)
                {
                    ListItemInfo item = listItem[i];
                    Bitmap map = GetBarCode(item.CDTXM);
                    pictureBox1.Image = map;
                    if (listItem.Count > i + 1)
                    {
                        map = GetBarCode(listItem[i + 1].CDTXM);
                        pictureBox2.Image = map;
                    }
                    if (listItem.Count > i + 2)
                    {
                        map = GetBarCode(listItem[i + 2].CDTXM);
                        pictureBox2.Image = map;
                    }
                    if (listItem.Count > i + 3)
                    {
                        map = GetBarCode(listItem[i + 3].CDTXM);
                        pictureBox3.Image = map;
                    }

                    DoPrint();
                }
                //this.Close();
            }
            catch (Exception ex)
            {
                LogHelper.ErrorFormat("Tape9840ShowForm Load exception:{0}{1}", ex.Message, ex.StackTrace);
            }
        }
    }
}
